/**
 * 商品备案申请列表js
 */

app.controller('btnCtrl', ['$scope', '$http', BtnController]);
function BtnController($scope, $http){
	//列表

	$scope.bindBtn = function(event) {
		var datas = $scope.getSelectedRows();
		switch(event){
			case 'event-to-add-new':
			{
				window.top.add_tab("商品备案申请 - 新增","/web/business/tpProductBq/toAdd?commodityProperty=新品");
				break;
			}
			case 'event-to-add-youpin':
			{
				window.top.add_tab("商品备案申请 - 新增","/web/business/tpProductBq/toAdd?commodityProperty=优品");
				break;
			}
			case 'event-to-add-change':
			{
				window.top.add_tab("商品备案申请 - 新增","/web/business/tpProductBq/toAdd?commodityProperty=变体");
				break;
			}
			case 'event-to-add-jingpin':
			{
				window.top.add_tab("商品备案申请 - 新增","/web/business/tpProductBq/toAdd?commodityProperty=精品");
				break;
			}
			case 'event-to-export':
			{
				$scope.doExport('/api/inter/tcwWanliOtherPayment/export');
				break;
			}
			case 'event-to-edit':
			{
				if(datas.length == 0) {
					layer.alert('尚未选中数据');
				} else if(datas.length > 1) {
					layer.alert('只能选中一行数据');
				} else {
					window.top.add_tab("商品备案申请 - 编辑变体("+datas[0].bid+")","/web/business/tpProductBq/toEdit?id="+datas[0].id+'&commodityProperty='+datas[0].commodityProperty,1);
				}
				break;
			}
			case 'LAYTABLE_EXPORT_DATA':
			{
				$scope.doExport('/api/inter/tpProductBq/export');
				break;
			}
			case 'event-to-import'://主表信息导入
			{
				$scope.showModalLink('/toImport?menuId=' + 10183, '批量导入');
				break;
			}
		};
	}
}


//双击
app.controller('dbClickCtrl', ['$scope', '$http', DbClickController]);
function DbClickController($scope, $http){
	$scope.doubleClick = function(data) {
		window.top.add_tab("商品备案申请 - "+data.commodityProperty + "("+data.bid+")","/web/business/tpProductBq/toEdit?bid="+data.bid);
	}
}

